Optimal. Leaf size=127 \[ -\frac{1}{4} (d-f) \log \left (x^2-x+1\right )+\frac{1}{4} (d-f) \log \left (x^2+x+1\right )-\frac{(d+f) \tan ^{-1}\left (\frac{1-2 x}{\sqrt{3}}\right )}{2 \sqrt{3}}+\frac{(d+f) \tan ^{-1}\left (\frac{2 x+1}{\sqrt{3}}\right )}{2 \sqrt{3}}+\frac{(2 e-g) \tan ^{-1}\left (\frac{2 x^2+1}{\sqrt{3}}\right )}{2 \sqrt{3}}+\frac{1}{4} g \log \left (x^4+x^2+1\right ) \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.101051, antiderivative size = 127, normalized size of antiderivative = 1., number of steps used = 15, number of rules used = 7, integrand size = 26, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.269, Rules used = {1673, 1169, 634, 618, 204, 628, 1247} \[ -\frac{1}{4} (d-f) \log \left (x^2-x+1\right )+\frac{1}{4} (d-f) \log \left (x^2+x+1\right )-\frac{(d+f) \tan ^{-1}\left (\frac{1-2 x}{\sqrt{3}}\right )}{2 \sqrt{3}}+\frac{(d+f) \tan ^{-1}\left (\frac{2 x+1}{\sqrt{3}}\right )}{2 \sqrt{3}}+\frac{(2 e-g) \tan ^{-1}\left (\frac{2 x^2+1}{\sqrt{3}}\right )}{2 \sqrt{3}}+\frac{1}{4} g \log \left (x^4+x^2+1\right ) \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 1673
Rule 1169
Rule 634
Rule 618
Rule 204
Rule 628
Rule 1247
Rubi steps
\begin{align*} \int \frac{d+e x+f x^2+g x^3}{1+x^2+x^4} \, dx &=\int \frac{d+f x^2}{1+x^2+x^4} \, dx+\int \frac{x \left (e+g x^2\right )}{1+x^2+x^4} \, dx\\ &=\frac{1}{2} \int \frac{d-(d-f) x}{1-x+x^2} \, dx+\frac{1}{2} \int \frac{d+(d-f) x}{1+x+x^2} \, dx+\frac{1}{2} \operatorname{Subst}\left (\int \frac{e+g x}{1+x+x^2} \, dx,x,x^2\right )\\ &=\frac{1}{4} (d-f) \int \frac{1+2 x}{1+x+x^2} \, dx+\frac{1}{4} (-d+f) \int \frac{-1+2 x}{1-x+x^2} \, dx+\frac{1}{4} (d+f) \int \frac{1}{1-x+x^2} \, dx+\frac{1}{4} (d+f) \int \frac{1}{1+x+x^2} \, dx+\frac{1}{4} (2 e-g) \operatorname{Subst}\left (\int \frac{1}{1+x+x^2} \, dx,x,x^2\right )+\frac{1}{4} g \operatorname{Subst}\left (\int \frac{1+2 x}{1+x+x^2} \, dx,x,x^2\right )\\ &=-\frac{1}{4} (d-f) \log \left (1-x+x^2\right )+\frac{1}{4} (d-f) \log \left (1+x+x^2\right )+\frac{1}{4} g \log \left (1+x^2+x^4\right )+\frac{1}{2} (-d-f) \operatorname{Subst}\left (\int \frac{1}{-3-x^2} \, dx,x,-1+2 x\right )+\frac{1}{2} (-d-f) \operatorname{Subst}\left (\int \frac{1}{-3-x^2} \, dx,x,1+2 x\right )+\frac{1}{2} (-2 e+g) \operatorname{Subst}\left (\int \frac{1}{-3-x^2} \, dx,x,1+2 x^2\right )\\ &=-\frac{(d+f) \tan ^{-1}\left (\frac{1-2 x}{\sqrt{3}}\right )}{2 \sqrt{3}}+\frac{(d+f) \tan ^{-1}\left (\frac{1+2 x}{\sqrt{3}}\right )}{2 \sqrt{3}}+\frac{(2 e-g) \tan ^{-1}\left (\frac{1+2 x^2}{\sqrt{3}}\right )}{2 \sqrt{3}}-\frac{1}{4} (d-f) \log \left (1-x+x^2\right )+\frac{1}{4} (d-f) \log \left (1+x+x^2\right )+\frac{1}{4} g \log \left (1+x^2+x^4\right )\\ \end{align*}
Mathematica [C] time = 0.484633, size = 150, normalized size = 1.18 \[ \frac{2 \left (\sqrt{2+2 i \sqrt{3}} \left (\left (\sqrt{3}+i\right ) f-2 i d\right ) \tan ^{-1}\left (\frac{1}{2} \left (\sqrt{3}+i\right ) x\right )+(2 g-4 e) \tan ^{-1}\left (\frac{\sqrt{3}}{2 x^2+1}\right )+\sqrt{3} g \log \left (x^4+x^2+1\right )\right )+2 \sqrt{2-2 i \sqrt{3}} \left (2 i d+\left (\sqrt{3}-i\right ) f\right ) \tan ^{-1}\left (\frac{1}{2} \left (\sqrt{3}-i\right ) x\right )}{8 \sqrt{3}} \]
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.004, size = 204, normalized size = 1.6 \begin{align*}{\frac{d\ln \left ({x}^{2}+x+1 \right ) }{4}}-{\frac{\ln \left ({x}^{2}+x+1 \right ) f}{4}}+{\frac{\ln \left ({x}^{2}+x+1 \right ) g}{4}}+{\frac{d\sqrt{3}}{6}\arctan \left ({\frac{ \left ( 1+2\,x \right ) \sqrt{3}}{3}} \right ) }-{\frac{\sqrt{3}e}{3}\arctan \left ({\frac{ \left ( 1+2\,x \right ) \sqrt{3}}{3}} \right ) }+{\frac{\sqrt{3}f}{6}\arctan \left ({\frac{ \left ( 1+2\,x \right ) \sqrt{3}}{3}} \right ) }+{\frac{\sqrt{3}g}{6}\arctan \left ({\frac{ \left ( 1+2\,x \right ) \sqrt{3}}{3}} \right ) }+{\frac{\ln \left ({x}^{2}-x+1 \right ) f}{4}}-{\frac{d\ln \left ({x}^{2}-x+1 \right ) }{4}}+{\frac{\ln \left ({x}^{2}-x+1 \right ) g}{4}}+{\frac{d\sqrt{3}}{6}\arctan \left ({\frac{ \left ( 2\,x-1 \right ) \sqrt{3}}{3}} \right ) }+{\frac{\sqrt{3}e}{3}\arctan \left ({\frac{ \left ( 2\,x-1 \right ) \sqrt{3}}{3}} \right ) }+{\frac{\sqrt{3}f}{6}\arctan \left ({\frac{ \left ( 2\,x-1 \right ) \sqrt{3}}{3}} \right ) }-{\frac{\sqrt{3}g}{6}\arctan \left ({\frac{ \left ( 2\,x-1 \right ) \sqrt{3}}{3}} \right ) } \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 1.47307, size = 112, normalized size = 0.88 \begin{align*} \frac{1}{6} \, \sqrt{3}{\left (d - 2 \, e + f + g\right )} \arctan \left (\frac{1}{3} \, \sqrt{3}{\left (2 \, x + 1\right )}\right ) + \frac{1}{6} \, \sqrt{3}{\left (d + 2 \, e + f - g\right )} \arctan \left (\frac{1}{3} \, \sqrt{3}{\left (2 \, x - 1\right )}\right ) + \frac{1}{4} \,{\left (d - f + g\right )} \log \left (x^{2} + x + 1\right ) - \frac{1}{4} \,{\left (d - f - g\right )} \log \left (x^{2} - x + 1\right ) \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 2.98584, size = 261, normalized size = 2.06 \begin{align*} \frac{1}{6} \, \sqrt{3}{\left (d - 2 \, e + f + g\right )} \arctan \left (\frac{1}{3} \, \sqrt{3}{\left (2 \, x + 1\right )}\right ) + \frac{1}{6} \, \sqrt{3}{\left (d + 2 \, e + f - g\right )} \arctan \left (\frac{1}{3} \, \sqrt{3}{\left (2 \, x - 1\right )}\right ) + \frac{1}{4} \,{\left (d - f + g\right )} \log \left (x^{2} + x + 1\right ) - \frac{1}{4} \,{\left (d - f - g\right )} \log \left (x^{2} - x + 1\right ) \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.11059, size = 115, normalized size = 0.91 \begin{align*} \frac{1}{6} \, \sqrt{3}{\left (d + f + g - 2 \, e\right )} \arctan \left (\frac{1}{3} \, \sqrt{3}{\left (2 \, x + 1\right )}\right ) + \frac{1}{6} \, \sqrt{3}{\left (d + f - g + 2 \, e\right )} \arctan \left (\frac{1}{3} \, \sqrt{3}{\left (2 \, x - 1\right )}\right ) + \frac{1}{4} \,{\left (d - f + g\right )} \log \left (x^{2} + x + 1\right ) - \frac{1}{4} \,{\left (d - f - g\right )} \log \left (x^{2} - x + 1\right ) \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]